using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using XDL.Framework.Configuration;
using Microsoft.Xna.Framework;

namespace XDL.Framework.Graphics
{
    /// <summary>
    /// Stores the definition of a camera.
    /// </summary>
    public class CameraInformation
    {
        /// <summary>
        /// Camera name
        /// </summary>
        public readonly string Name;

        /// <summary>
        /// Camera position
        /// </summary>
        public readonly Vector3 Position;

        /// <summary>
        /// Field of View (in degrees)
        /// </summary>
        public float FoV = 45.0f;

        /// <summary>
        /// Near clipping plane position.
        /// </summary>
        public float ClipNear = 0.1f;

        /// <summary>
        /// Far clipping plane position.
        /// </summary>
        public float ClipFar = 1000.0f;

        /// <summary>
        /// Creates a new instance with the information from the XML stream.
        /// </summary>
        /// <param name="xd">XML node</param>
        public CameraInformation(XmlNode xd)
        {
            // <Camera name="Camera" position="95.377502;-116.128159;15.905484" fov="49.134342" clipStart="0.100000" clipEnd="1000.000000"></Camera>
            this.Name = xd.Attributes["name"].Value;
            this.Position = XmlHelper.ReadXmlVector<Vector3>(xd.Attributes["position"].Value);
            this.FoV = XmlHelper.ReadXmlFloat(xd.Attributes["fov"].Value);
            this.ClipNear = XmlHelper.ReadXmlFloat(xd.Attributes["clipStart"].Value);
            this.ClipFar = XmlHelper.ReadXmlFloat(xd.Attributes["clipEnd"].Value);
        }
    }
}
